﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Principal;

namespace ATest.Tests.MockObjects
{
    public class MockPrincipal : Moq.Mock<IPrincipal>
    {
        public MockPrincipal()
        {
        }

        public MockPrincipal(MockIdentity identity)
        {
            SetIdentity(identity);
        }

        public MockPrincipal(IIdentity identity)
        {
            SetIdentity(identity);
        }

        public void SetIdentity(MockIdentity identity)
        {
            SetIdentity(identity.Object);
        }

        public void SetIdentity(IIdentity identity)
        {
            this.Setup(x => x.Identity).Returns(identity);
        }

        public void SetIsRole(string role, bool value)
        {
            this.Setup(x => x.IsInRole(role)).Returns(value);
        }
    }
}
